package com.cloud.workmanagerdemo

import android.content.Context
import android.util.Log
import androidx.work.Data
import androidx.work.Worker
import androidx.work.WorkerParameters

/**
 * @auth: njb
 * @date: 2024/11/26 23:38
 * @desc: 传达数据
 */
class TransferDataWork(context: Context, workerParams: WorkerParameters) :
    Worker(context, workerParams) {

    override fun doWork(): Result {
        val activityData = inputData.getString("data")
        Log.e(Constants.TAG,"传递数据任务 $activityData ")
        val data = Data.Builder()
            .putString("data", "TransferDataWork的数据").build()
        return Result.success(data)
    }
}
